<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <title>悦读，从这里开始</title>
    <link rel="stylesheet" th:href="@{/css/menu.css}" >
    <style>
            .back{
                position: absolute;
                top:468px;
                left:188px;
            }

            .bbox {:
               display: flex;
               color:blue;
            }
            .first {
              display: flex;
              position:absolute;
              top:500px;
              left:200px;
              justify-content: center;
              border-radius: 5px;
            }

            .first > div {
              width:280px;
              height:115px;
              background-color: #00CFFF;
              margin: 10px 18px;
              font-size: 30px;
              border-radius: 10px;
              box-shadow:1px 1px 3px #668B8B;
            }
            .first > div:hover{
            cursor: pointer;
            box-shadow:2px 2px 3px #353538;/*传统朱墨色*/
            margin:8px 18px 10px 18px;
            }
            .sec {
              display: flex;
              position:absolute;
              top:660px;
              left:200px;
              justify-content: center;
              border-radius: 5px;
            }

            .sec > div {
              width:280px;
              height:115px;
              background-color: #00CFFF;
              font-size: 30px;
              border-radius: 10px;
              margin:10px 18px;
              box-shadow:1px 1px 3px #668B8B;
            }
            .sec > div:hover{
            cursor: pointer;
            box-shadow:2px 2px 3px #353538;/*传统朱墨色*/
            margin:8px 18px 10px 18px;
            }
            .slider {
              width: 87%;
              height: 400px;
              left:180px;
              overflow: hidden;
              position: relative;
            }

            .slide {
              width: 100%;
              height: 100%;
              position: absolute;
              top: 0;
              left: 0;
              opacity: 0;
              transition: opacity 1s ease;
            }

            .slide:hover{
            cursor: pointer;
            }

            .slide.active {
              opacity: 1;
            }
            .responsive-image {
                  display: block;
                  max-width: 100%;
                  height: auto;
            }
    </style>
</head>
<body>
<div th:replace="~{commons/menu::common-menu}"></div>


<div class="slider">
    <div class="slide">
        <img src="/img/lb1.png" alt="Slide 1" class="responsive-image">
    </div>
    <div class="slide">
        <img src="/img/lb2.png" alt="Slide 2" class="responsive-image">
    </div>
    <div class="slide">
        <img src="/img/lb3.png" alt="Slide 3" class="responsive-image">
    </div>
</div>

<div class="back">
    <img src="/img/backpicture.png" width="1300px" height="400px" >
</div>

<div class="bbox">
    <div class="first">
        <div class="block1" th:onclick="|window.location.href='/user/articleDetails?id=1'|"><img src="/img/banner1.png" alt="" width="280px" height="115px"></div>
        <div class="block2" th:onclick="|window.location.href='/user/articleDetails?id=2'|"><img src="/img/banner2.png" alt="" width="280px" height="115px"></div>
        <div class="block3" th:onclick="|window.location.href='/user/articleDetails?id=3'|"><img src="/img/banner3.png" alt="" width="280px" height="115px"></div>
        <div class="block4" th:onclick="|window.location.href='/user/articleDetails?id=4'|"><img src="/img/banner4.png" alt="" width="280px" height="115px"></div>
    </div>
    <div class="sec">
        <div class="block5" th:onclick="|window.location.href='/user/articleDetails?id=5'|"><img src="/img/banner5.png" alt="" width="280px" height="115px"></div>
        <div class="block6" th:onclick="|window.location.href='/user/articleDetails?id=6'|"><img src="/img/banner6.png" alt="" width="280px" height="115px"></div>
        <div class="block7" th:onclick="|window.location.href='/user/articleDetails?id=7'|"><img src="/img/banner7.png" alt="" width="280px" height="115px"></div>
        <div class="block8" th:onclick="|window.location.href='/user/articleDetails?id=8'|"><img src="/img/banner8.png" alt="" width="280px" height="115px"></div>
    </div>
</div>





<script>
        function goBack() {
          window.history.go(-1);
        }

        const slides = document.querySelectorAll('.slide');
        let currentSlide = 0;
        slides[currentSlide].classList.add('active');

        function nextSlide() {
          slides[currentSlide].classList.remove('active');
          currentSlide = (currentSlide + 1) % slides.length;
          slides[currentSlide].classList.add('active');
        }

        setInterval(nextSlide, 2000);

        window.addEventListener('load', function() {
          const image = document.querySelector('.responsive-image');
          adjustImageSize(image);
        });

        window.addEventListener('resize', function() {
          const image = document.querySelector('.responsive-image');
          adjustImageSize(image);
        });

        function adjustImageSize(image) {
          // 调整图片的缩放逻辑，例如保持比例，限制最大宽度等等
          image.style.maxWidth = '100%';
          image.style.height = 'auto';
        }
        </script>
</body>
</html>
